#include "face.hpp"

using namespace std;

Face::Face(Process *pro, States *_state):Observer(pro)
{
	state = _state;
	inFile.open("Data/test.txt");
	char temp;

	if(inFile.is_open())
	{
		while(!inFile.eof())
		{
			inFile >> temp;
			if (temp != ':')
				continue;
			else
			{
				int x,y;
				inFile >> x >> temp >> y ;
				I_Rect r(x,y,108,120);
				In_box.push_back(r);
				std::cout << x << "," << y << std::endl;
			}
		}

	}

	outFile.open("test_1.txt");
}

Face::~Face()
{
	Log("Release Face");

	_pro->Detach(this);
}

void Face::Update(const Image &image)
{
	if( state->TrackObject.size()>0)
	{
		CaliBox.clear();
		CaliBox.push_back(I_Rect(In_box[_pro->m_count].x, In_box[_pro->m_count].y, 108, 120));
		CaliPoint = I_Point(state->origin.x, state->origin.y);
	}
}
